<script>
// require("./umtrack-wx.js");
var e = require("./utils/config.js"),
    t = require("./utils/request.js"),
    a = require("./utils/util.js"),
    o = function (e) {
  return e && e.__esModule ? e : {
    default: e
  };
}(require("./utils/api.js")),
    n = e.config.stationID,
    i = o.default.getOpenId,
    s = o.default.loginByToken,
    r = o.default.loginById; 

export default {
  globalData: {
    umengConfig: {
      appKey: "5e915abadbc2ec07e86bbdff",
      useOpenid: !0,
      autoGetOpenid: !0,
      debug: !1
    },
    editTabbar: function () {
      var e = this.tabbar,
          t = getCurrentPages(),
          a = t[t.length - 1],
          o = a.route;
      0 != o.indexOf("/") && (o = "/" + o);

      for (var n in e.list) e.list[n].selected = !1, e.list[n].pagePath == o && (e.list[n].selected = !0);

      a.setData({
        tabbar: e
      });
    },
    userInfo: null,
    token: "",
    openId: "",
    zyzId: "",
    loginFlag: !1,
    latitude: "",
    longitude: "",
    cityName: "",
    cityId: "",
    gpsCityName: "",
    gpsCityId: "",
    iOSSystem: !1,
    tabbar: {
      color: "#777878",
      selectedColor: "#24CBA9",
      backgroundColor: "#FFFFFF",
      borderStyle: "black",
      list: [{
        pagePath: "/pages/index/index",
        text: "首页",
        iconPath: "/static/images/icon_tab_home.png",
        selectedIconPath: "/static/images/icon_tab_home_active.png"
      }, {
        pagePath: "/pages/me/me",
        text: "我",
        iconPath: "/static/images/icon_tab_me.png",
        selectedIconPath: "/static/images/icon_tab_me_active.png"
      }]
    },
    getOpenIdRequest: function (e) {
      var o = this,
          s = {
        data: {
          api: i,
          apimode: "xsdwmsj",
          apidata: '{"siteId": "' + n + '", "code": "' + e + '", "type": "WeChat"}'
        }
      };
      return (0, t.request)(s, "common", !1, "other").then(function (e) {
        if (e.data.errorCode === a.ERR_OK) return o.openId = e.data.data.openid, o.userLoginById();
        uni.showToast({
          title: e.data.message?e.data.message:'',
          icon: "none"
        });
      }).then(function (e) {
        return e.data.errCode === a.ERR_OK ? (o.token = e.data.token, o.loginFlag = !0, o.userLoginByToken()) : Promise.reject(e);
      }).then(function (e) {
        e.data.errCode === a.ERR_OK && (o.zyzId = e.data.userId);
      }).catch(function (e) {
        // console.log(e.data.message);
      });
    },
    userLoginById: function () {
      var e = {
        data: {
          api: r,
          apimode: "vmsapi",
          openid: this.globalData.openId
        }
      };
      return (0, t.request)(e, "common", !1);
    },
    userLoginByToken: function () {
      var e = {
        data: {
          api: s
        },
        token: this.globalData.token
      };
      return (0, t.request)(e, "common", !1);
    }
  },
  onLaunch: function () {
    var e = this;

    try {
      uni.setStorageSync("cityType", "none");
    } catch (e) {
      console.log(e);
    }

    try {
      uni.setStorageSync("gpsFlag", "none");
    } catch (e) {
      console.log(e);
    }
	var that = this
	uni.onTabBarMidButtonTap(()=>{
			uni.navigateTo({
				url:"/pages/signin/signin"
			})

	});
	

    // uni.login({
    //   success: function (t) {
    //     "login:ok" === t.errMsg && t.code && e.globalData.getOpenIdRequest(t.code);
    //   }
    // }), uni.getSetting({
    //   success: function (t) {
    //     t.authSetting["scope.userInfo"] && uni.getUserInfo({
    //       success: function (t) {
    //         e.globalData.userInfo = t.userInfo, e.userInfoReadyCallback && e.userInfoReadyCallback(t);
    //       }
    //     }), t.authSetting["scope.userLocation"] ? e.globalData.gpsSet = 1 : e.globalData.gpsSet = 0;
    //   }
    // });
  },
  methods: {}
};
</script>
<style>
	uni-tabbar {
		z-index: 999999;
	}
image,view {
    box-sizing: border-box;
}

button {
    padding: 0;
    font-size: 26rpx;
    font-weight: 400;
}



.container {
    width: 100%;
    height: 100%;
}

.hidden {
	display: none !important;
}

.flex {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-content: center;
    align-items: center;
}

.flex_box {
    flex: auto;
}

.split {
    width: 100%;
    height: 10rpx;
    background: #f4f4f4;
}

.input_sec {
    position: relative;
    justify-content: flex-start;
    width: calc(100% - 30rpx);
    height: 110rpx;
    margin-left: 30rpx;
    border-bottom: 1rpx solid rgba(225,226,227,.75);
}

.input_sec.select image {
    position: absolute;
    right: 30rpx;
    top: 50%;
    z-index: 3;
    transform: translateY(-50%);
    width: 12rpx;
    height: 24rpx;
}

.input_sec view {
    flex: 0 0 150rpx;
    width: 150rpx;
    height: 110rpx;
    line-height: 110rpx;
    text-align-last: justify;
}

.input_sec input {
    flex: auto;
    height: 110rpx;
    padding: 0 12rpx;
    font-size: 30rpx;
    color: #333;
}

.theme_btn {
    background: #24cba9!important;
    color: #fff!important;
}

.default_btn {
    border: 1rpx solid #24cba9!important;
    color: #24cba9!important;
}

.cancel_btn,.disabled_btn {
    background: #d8d8d8!important;
}

.call {
    position: fixed;
    left: 50%;
    bottom: 80rpx;
    z-index: 3;
    transform: translateX(-50%);
    font-size: 28rpx;
    color: #b4b4b4;
}

.nodata_txt {
    padding: 120rpx 0;
    color: #666;
}

.no_data,.no_more,.nodata_txt {
    text-align: center;
    font-size: 26rpx;
}

.no_data,.no_more {
    padding: 80rpx 0;
    color: #999;
}
</style>